Univariate Stock Predictions: LSTM, ARIMA, and prophet

INFO 523 - Final Project

Project description
Author
Affiliation

Matt Osterhoudt

College of Information Science, University of Arizona

Abstract

Introduction/Question

Approach

Code & Visual Analysis

<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 504 entries, 2022-12-29 00:00:00-05:00 to 2024-12-31 00:00:00-05:00
Data columns (total 1 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Close   504 non-null    float64
dtypes: float64(1)
memory usage: 7.9 KB
p-value pre-difference: 0.8514689856456278
p-value post-difference: 8.881012681150976e-28
                               SARIMAX Results                                
==============================================================================
Dep. Variable:                  Close   No. Observations:                 2012
Model:                 ARIMA(9, 1, 9)   Log Likelihood               -5023.217
Date:                Wed, 20 Aug 2025   AIC                          10086.433
Time:                        19:59:57   BIC                          10198.561
Sample:                             0   HQIC                         10127.593
                               - 2012                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
x1             0.0972      0.050      1.959      0.050   -7.19e-05       0.195
ar.L1          0.0421      0.073      0.578      0.564      -0.101       0.185
ar.L2         -0.1141      0.071     -1.598      0.110      -0.254       0.026
ar.L3          0.1243      0.068      1.834      0.067      -0.009       0.257
ar.L4         -0.1045      0.058     -1.814      0.070      -0.217       0.008
ar.L5         -0.0813      0.069     -1.187      0.235      -0.216       0.053
ar.L6         -0.0950      0.068     -1.400      0.161      -0.228       0.038
ar.L7          0.1077      0.066      1.637      0.102      -0.021       0.237
ar.L8          0.0835      0.058      1.446      0.148      -0.030       0.197
ar.L9          0.6358      0.064      9.979      0.000       0.511       0.761
ma.L1         -0.1384      0.076     -1.815      0.070      -0.288       0.011
ma.L2          0.1170      0.074      1.571      0.116      -0.029       0.263
ma.L3         -0.1675      0.069     -2.416      0.016      -0.303      -0.032
ma.L4          0.1165      0.063      1.857      0.063      -0.006       0.239
ma.L5          0.0838      0.072      1.165      0.244      -0.057       0.225
ma.L6          0.0200      0.071      0.282      0.778      -0.119       0.159
ma.L7         -0.0764      0.070     -1.095      0.273      -0.213       0.060
ma.L8         -0.1730      0.061     -2.836      0.005      -0.293      -0.053
ma.L9         -0.5079      0.070     -7.281      0.000      -0.645      -0.371
sigma2         8.6460      0.139     62.216      0.000       8.374       8.918
===================================================================================
Ljung-Box (L1) (Q):                   0.13   Jarque-Bera (JB):              4169.41
Prob(Q):                              0.71   Prob(JB):                         0.00
Heteroskedasticity (H):              44.74   Skew:                            -0.54
Prob(H) (two-sided):                  0.00   Kurtosis:                         9.97
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).

p-value pre-difference: 0.7797885244796738
p-value post-difference: 3.723246644121633e-26
                               SARIMAX Results                                
==============================================================================
Dep. Variable:                  Close   No. Observations:                 2012
Model:                 ARIMA(9, 1, 6)   Log Likelihood               -5248.487
Date:                Wed, 20 Aug 2025   AIC                          10530.974
Time:                        20:00:07   BIC                          10626.283
Sample:                             0   HQIC                         10565.960
                               - 2012                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
x1             0.0965      0.077      1.258      0.208      -0.054       0.247
ar.L1         -1.0113      0.196     -5.169      0.000      -1.395      -0.628
ar.L2         -0.1855      0.134     -1.387      0.165      -0.448       0.077
ar.L3          0.1324      0.097      1.358      0.174      -0.059       0.323
ar.L4         -0.5999      0.083     -7.266      0.000      -0.762      -0.438
ar.L5         -1.0446      0.167     -6.252      0.000      -1.372      -0.717
ar.L6         -0.6080      0.120     -5.083      0.000      -0.842      -0.374
ar.L7          0.0256      0.022      1.137      0.256      -0.018       0.070
ar.L8         -0.0213      0.028     -0.768      0.443      -0.076       0.033
ar.L9          0.0162      0.028      0.570      0.568      -0.040       0.072
ma.L1          0.9522      0.195      4.882      0.000       0.570       1.335
ma.L2          0.1409      0.126      1.121      0.262      -0.105       0.387
ma.L3         -0.1204      0.096     -1.258      0.208      -0.308       0.067
ma.L4          0.5766      0.079      7.329      0.000       0.422       0.731
ma.L5          0.9999      0.158      6.334      0.000       0.691       1.309
ma.L6          0.5168      0.108      4.784      0.000       0.305       0.729
sigma2        10.8981      0.186     58.446      0.000      10.533      11.264
===================================================================================
Ljung-Box (L1) (Q):                   0.00   Jarque-Bera (JB):              3778.15
Prob(Q):                              0.95   Prob(JB):                         0.00
Heteroskedasticity (H):               9.57   Skew:                            -0.78
Prob(H) (two-sided):                  0.00   Kurtosis:                         9.53
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).

p-value pre-difference: 0.8961137195212532
p-value post-difference: 1.6481018977694262e-26
                               SARIMAX Results                                
==============================================================================
Dep. Variable:                  Close   No. Observations:                 2012
Model:                 ARIMA(2, 1, 2)   Log Likelihood                2485.616
Date:                Wed, 20 Aug 2025   AIC                          -4959.233
Time:                        20:00:13   BIC                          -4925.595
Sample:                             0   HQIC                         -4946.885
                               - 2012                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
x1             0.0030      0.002      2.001      0.045    6.27e-05       0.006
ar.L1         -1.7917      0.015   -121.463      0.000      -1.821      -1.763
ar.L2         -0.9154      0.014    -65.028      0.000      -0.943      -0.888
ma.L1          1.7252      0.019     90.184      0.000       1.688       1.763
ma.L2          0.8281      0.018     44.761      0.000       0.792       0.864
sigma2         0.0049   6.39e-05     77.322      0.000       0.005       0.005
===================================================================================
Ljung-Box (L1) (Q):                   0.60   Jarque-Bera (JB):             10328.54
Prob(Q):                              0.44   Prob(JB):                         0.00
Heteroskedasticity (H):              12.88   Skew:                            -0.09
Prob(H) (two-sided):                  0.00   Kurtosis:                        14.10
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).

Model: "sequential"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Layer (type)                     Output Shape                  Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ lstm (LSTM)                     │ (None, 50)             │        10,400 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dropout (Dropout)               │ (None, 50)             │             0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense (Dense)                   │ (None, 8)              │           408 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_1 (Dense)                 │ (None, 1)              │             9 │
└─────────────────────────────────┴────────────────────────┴───────────────┘
 Total params: 10,817 (42.25 KB)
 Trainable params: 10,817 (42.25 KB)
 Non-trainable params: 0 (0.00 B)
 1/16 ━━━━━━━━━━━━━━━━━━━ 1s 116ms/step

14/16 ━━━━━━━━━━━━━━━━━━━━ 0s 4ms/step  

16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 11ms/step

16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 11ms/step

Model: "sequential_1"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Layer (type)                     Output Shape                  Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ lstm_1 (LSTM)                   │ (None, 50)             │        10,400 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dropout_1 (Dropout)             │ (None, 50)             │             0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_2 (Dense)                 │ (None, 8)              │           408 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_3 (Dense)                 │ (None, 1)              │             9 │
└─────────────────────────────────┴────────────────────────┴───────────────┘
 Total params: 10,817 (42.25 KB)
 Trainable params: 10,817 (42.25 KB)
 Non-trainable params: 0 (0.00 B)
 1/16 ━━━━━━━━━━━━━━━━━━━ 1s 110ms/step

13/16 ━━━━━━━━━━━━━━━━━━━━ 0s 4ms/step  

16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 11ms/step

16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 12ms/step

Model: "sequential_2"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Layer (type)                     Output Shape                  Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ lstm_2 (LSTM)                   │ (None, 50)             │        10,400 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dropout_2 (Dropout)             │ (None, 50)             │             0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_4 (Dense)                 │ (None, 8)              │           408 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dense_5 (Dense)                 │ (None, 1)              │             9 │
└─────────────────────────────────┴────────────────────────┴───────────────┘
 Total params: 10,817 (42.25 KB)
 Trainable params: 10,817 (42.25 KB)
 Non-trainable params: 0 (0.00 B)
 1/16 ━━━━━━━━━━━━━━━━━━━ 1s 110ms/step

13/16 ━━━━━━━━━━━━━━━━━━━━ 0s 4ms/step  

16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 12ms/step

16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 13ms/step

Discussion

Conclusion

Add project abstract here.